home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 March
/
PCWorld_2007-03_cd.bin
/
komunikace
/
acehtml
/
acehtmlfreeware.exe
/
scriptdef
/
Select A Month.sd
< prev
next >
Wrap
INI File
|
2006-09-13
|
5KB
|
184 lines
[SUBJECT]
Description=Builds calendar for a month
ImageIndex=-1
Folder=Tools
[HEAD_TEXT]
;<script language="JavaScript">
;<!-- Begin
; var now,day,month,year;
;function setToday() {
;now = new Date();
;day = now.getDate();
;month = now.getMonth();
;year = now.getYear();
;if (year < 2000) // Y2K Fix, Isaac Powell
;year = year + 1900; // http://onyx.idbsu.edu/~ipowell
;this.focusDay = day;
;document.calControl.month.selectedIndex = month;
;document.calControl.year.value = year;
;displayCalendar(month, year);
;}
;function isFourDigitYear(year) {
;if (year.length != 4) {
;alert ("Sorry, the year must be four-digits in length.");
;document.calControl.year.select();
;document.calControl.year.focus();
;} else { return true; }
;}
;function selectDate() {
;year = document.calControl.year.value;
;if (isFourDigitYear(year)) {
;day = 0;
;month = document.calControl.month.selectedIndex;
;displayCalendar(month, year);
; }
;}
;
;function setPreviousYear() {
;year = document.calControl.year.value;
;if (isFourDigitYear(year)) {
;day = 0;
;month = document.calControl.month.selectedIndex;
;year--;
;document.calControl.year.value = year;
;displayCalendar(month, year);
; }
;}
;function setPreviousMonth() {
;year = document.calControl.year.value;
;if (isFourDigitYear(year)) {
;day = 0;
;month = document.calControl.month.selectedIndex;
;if (month == 0) {
;month = 11;
;if (year > 1000) {
;year--;
;document.calControl.year.value = year;
;}
;} else { month--; }
;document.calControl.month.selectedIndex = month;
;displayCalendar(month, year);
; }
;}
;function setNextMonth() {
;year = document.calControl.year.value;
;if (isFourDigitYear(year)) {
;day = 0;
;month = document.calControl.month.selectedIndex;
;if (month == 11) {
;month = 0;
;year++;
;document.calControl.year.value = year;
;} else { month++; }
;document.calControl.month.selectedIndex = month;
;displayCalendar(month, year);
; }
;}
;function setNextYear() {
;year = document.calControl.year.value;
;if (isFourDigitYear(year)) {
;day = 0;
;month = document.calControl.month.selectedIndex;
;year++;
;document.calControl.year.value = year;
;displayCalendar(month, year);
; }
;}
;function displayCalendar(month, year) {
;month = parseInt(month);
;year = parseInt(year);
;var i = 0;
;days = getDaysInMonth(month+1,year);
;var firstOfMonth = new Date (year, month, 1);
;var startingPos = firstOfMonth.getDay();
;days += startingPos;
;document.calControl.calPage.value = " Su Mo Tu We Th Fr Sa";
;document.calControl.calPage.value += "\n --------------------";
;for (i = 0; i < startingPos; i++) {
;if ( i%7 == 0 ) document.calControl.calPage.value += "\n ";
;document.calControl.calPage.value += " ";
;}
;for (i = startingPos; i < days; i++) {
;if ( i%7 == 0 ) document.calControl.calPage.value += "\n ";
;if (i-startingPos+1 < 10)
;document.calControl.calPage.value += "0";
;document.calControl.calPage.value += i-startingPos+1;
;document.calControl.calPage.value += " ";
;}
;for (i=days; i<42; i++) {
;if ( i%7 == 0 ) document.calControl.calPage.value += "\n ";
;document.calControl.calPage.value += " ";
;}
;document.calControl.Go.focus();
;}
;function getDaysInMonth(month,year) {
;var days;
;if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) days=31;
;else if (month==4 || month==6 || month==9 || month==11) days=30;
;else if (month==2) {
;if (isLeapYear(year)) { days=29; }
;else { days=28; }
;}
;return (days);
;}
;function isLeapYear (Year) {
;if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
;return (true);
;} else { return (false); }
;}
;// End -->
;</SCRIPT>
[BODY_TAG]
;onLoad="setToday()"
[BODY_TEXT]
;
;<div align="center">
;<h2>`Caption`</h2>
;<form name="calControl" onSubmit="return false;">
;<table cellpadding="0" cellspacing="0" border="0" summary="">
;<tr><td colspan="7">
;<select name="month" onChange="selectDate()">
;<option>January
;<option>February
;<option>March
;<option>April
;<option>May
;<option>June
;<option>July
;
;<option>August
;<option>September
;<option>October
;<option>November
;<option>December
;</select>
;<input name="year" type="text" size="4" maxlength="4">
;<input type="button" name="Go" value="Build!" onClick="selectDate()">
;
;</td>
;</tr>
;<tr><td align="center"><textarea font="Courier" name="calPage" wrap="no" rows="8" cols="22"></textarea>
</td><tr><td><div align="center">
;</TD></TR><TR><TD>
;<input type="button" name="previousYear" VALUE=" << " onClick="setPreviousYear()">
;<input type="button" name="previousYear" VALUE=" < " onClick="setPreviousMonth()">
;<input type="button" name="previousYear" VALUE="Today" onClick="setToday()">
;<input type="button" name="previousYear" VALUE=" > " onClick="setNextMonth()">
;<input type="button" name="previousYear" VALUE=" >> " onClick="setNextYear()">
;</td></tr>
;</table></form>
;</div>
;
[`Caption`]
Kind=S
Value=Select-A-Month